home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / QuickDraw 3D / Development / Interfaces / QD3DPascalInterfaces / QD3DCamera.p < prev    next >
Encoding:
Text File  |  1996-11-15  |  9.9 KB  |  234 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        QD3DCamera.p
  3.  
  4.      Contains:    Generic camera routines                                             
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.0.6
  7.                  Release:    Universal Interfaces 2.1.5d1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT QD3DCamera;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __QD3DCAMERA__}
  28. {$SETC __QD3DCAMERA__ := 1}
  29.  
  30. {$I+}
  31. {$SETC QD3DCameraIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __QD3D__}
  35. {$I QD3D.p}
  36. {$ENDC}
  37.  
  38. {$PUSH}
  39. {$ALIGN POWER}
  40. {$LibExport+}
  41.  
  42. {
  43. *****************************************************************************
  44.  **                                                                             **
  45.  **                            Data Structure Definitions                         **
  46.  **                                                                             **
  47.  ****************************************************************************
  48. }
  49. {
  50.  *  The placement of the camera.
  51. }
  52.  
  53. TYPE
  54.     TQ3CameraPlacementPtr = ^TQ3CameraPlacement;
  55.     TQ3CameraPlacement = RECORD
  56.         cameraLocation:            TQ3Point3D;                                {   Location point of the camera      }
  57.         pointOfInterest:        TQ3Point3D;                                {   Point of interest                  }
  58.         upVector:                TQ3Vector3D;                            {   "up" vector                      }
  59.     END;
  60.  
  61. {
  62.  *  The range of the camera.
  63. }
  64.     TQ3CameraRangePtr = ^TQ3CameraRange;
  65.     TQ3CameraRange = RECORD
  66.         hither:                    Single;                                    {   Hither plane, measured from "from" towards "to"     }
  67.         yon:                    Single;                                    {   Yon  plane, measured from "from" towards "to"      }
  68.     END;
  69.  
  70. {
  71.  *  Viewport specification.  Origin is (-1, 1), and corresponds to the 
  72.  *  upper left-hand corner; width and height maximum is (2.0, 2.0),
  73.  *  corresponding to the lower left-hand corner of the window.  The
  74.  *  TQ3Viewport specifies a part of the viewPlane that gets displayed 
  75.  *    on the window that is to be drawn.
  76.  *  Normally, it is set with an origin of (-1.0, 1.0), and a width and
  77.  *  height of both 2.0, specifying that the entire window is to be
  78.  *  drawn.  If, for example, an exposure event of the window exposed
  79.  *  the right half of the window, you would set the origin to (0, 1),
  80.  *  and the width and height to (1.0) and (2.0), respectively.
  81.  *
  82. }
  83.     TQ3CameraViewPortPtr = ^TQ3CameraViewPort;
  84.     TQ3CameraViewPort = RECORD
  85.         origin:                    TQ3Point2D;
  86.         width:                    Single;
  87.         height:                    Single;
  88.     END;
  89.  
  90.     TQ3CameraDataPtr = ^TQ3CameraData;
  91.     TQ3CameraData = RECORD
  92.         placement:                TQ3CameraPlacement;
  93.         range:                    TQ3CameraRange;
  94.         viewPort:                TQ3CameraViewPort;
  95.     END;
  96.  
  97. {
  98.  *  An orthographic camera.
  99.  *
  100.  *  The lens characteristics are set with the dimensions of a
  101.  *  rectangular viewPort in the frame of the camera.
  102. }
  103.     TQ3OrthographicCameraDataPtr = ^TQ3OrthographicCameraData;
  104.     TQ3OrthographicCameraData = RECORD
  105.         cameraData:                TQ3CameraData;
  106.         left:                    Single;
  107.         top:                    Single;
  108.         right:                    Single;
  109.         bottom:                    Single;
  110.     END;
  111.  
  112. {
  113.  *  A perspective camera specified in terms of an arbitrary view plane.
  114.  *
  115.  *  This is most useful when setting the camera to look at a particular
  116.  *  object.  The viewPlane is set to distance from the camera to the object.
  117.  *  The halfWidth is set to half the width of the cross section of the object,
  118.  *  and the halfHeight equal to the halfWidth divided by the aspect ratio
  119.  *  of the viewPort.
  120.  * 
  121.  *  This is the only perspective camera with specifications for off-axis
  122.  *  viewing, which is desirable for scrolling.
  123. }
  124.     TQ3ViewPlaneCameraDataPtr = ^TQ3ViewPlaneCameraData;
  125.     TQ3ViewPlaneCameraData = RECORD
  126.         cameraData:                TQ3CameraData;
  127.         viewPlane:                Single;
  128.         halfWidthAtViewPlane:    Single;
  129.         halfHeightAtViewPlane:    Single;
  130.         centerXOnViewPlane:        Single;
  131.         centerYOnViewPlane:        Single;
  132.     END;
  133.  
  134. {
  135.  *    A view angle aspect camera is a perspective camera specified in 
  136.  *    terms of the minimum view angle and the aspect ratio of X to Y.
  137.  *
  138. }
  139.     TQ3ViewAngleAspectCameraDataPtr = ^TQ3ViewAngleAspectCameraData;
  140.     TQ3ViewAngleAspectCameraData = RECORD
  141.         cameraData:                TQ3CameraData;
  142.         fov:                    Single;
  143.         aspectRatioXToY:        Single;
  144.     END;
  145.  
  146. {
  147. *****************************************************************************
  148.  **                                                                             **
  149.  **                            Generic Camera routines                             **
  150.  **                                                                             **
  151.  ****************************************************************************
  152. }
  153. FUNCTION Q3Camera_GetType(camera: TQ3CameraObject): TQ3ObjectType; C;
  154. FUNCTION Q3Camera_SetData(camera: TQ3CameraObject; {CONST}VAR cameraData: TQ3CameraData): TQ3Status; C;
  155. FUNCTION Q3Camera_GetData(camera: TQ3CameraObject; VAR cameraData: TQ3CameraData): TQ3Status; C;
  156. FUNCTION Q3Camera_SetPlacement(camera: TQ3CameraObject; {CONST}VAR placement: TQ3CameraPlacement): TQ3Status; C;
  157. FUNCTION Q3Camera_GetPlacement(camera: TQ3CameraObject; VAR placement: TQ3CameraPlacement): TQ3Status; C;
  158. FUNCTION Q3Camera_SetRange(camera: TQ3CameraObject; {CONST}VAR range: TQ3CameraRange): TQ3Status; C;
  159. FUNCTION Q3Camera_GetRange(camera: TQ3CameraObject; VAR range: TQ3CameraRange): TQ3Status; C;
  160. FUNCTION Q3Camera_SetViewPort(camera: TQ3CameraObject; {CONST}VAR viewPort: TQ3CameraViewPort): TQ3Status; C;
  161. FUNCTION Q3Camera_GetViewPort(camera: TQ3CameraObject; VAR viewPort: TQ3CameraViewPort): TQ3Status; C;
  162. FUNCTION Q3Camera_GetWorldToView(camera: TQ3CameraObject; VAR worldToView: TQ3Matrix4x4): TQ3Status; C;
  163. FUNCTION Q3Camera_GetWorldToFrustum(camera: TQ3CameraObject; VAR worldToFrustum: TQ3Matrix4x4): TQ3Status; C;
  164. FUNCTION Q3Camera_GetViewToFrustum(camera: TQ3CameraObject; VAR viewToFrustum: TQ3Matrix4x4): TQ3Status; C;
  165. {
  166. *****************************************************************************
  167.  **                                                                             **
  168.  **                            Specific Camera Routines                          **
  169.  **                                                                             **
  170.  ****************************************************************************
  171. }
  172. {
  173. *****************************************************************************
  174.  **                                                                             **
  175.  **                            Orthographic Camera                                  **
  176.  **                                                                             **
  177.  ****************************************************************************
  178. }
  179. FUNCTION Q3OrthographicCamera_New({CONST}VAR orthographicData: TQ3OrthographicCameraData): TQ3CameraObject; C;
  180. FUNCTION Q3OrthographicCamera_GetData(camera: TQ3CameraObject; VAR cameraData: TQ3OrthographicCameraData): TQ3Status; C;
  181. FUNCTION Q3OrthographicCamera_SetData(camera: TQ3CameraObject; {CONST}VAR cameraData: TQ3OrthographicCameraData): TQ3Status; C;
  182. FUNCTION Q3OrthographicCamera_SetLeft(camera: TQ3CameraObject; left: Single): TQ3Status; C;
  183. FUNCTION Q3OrthographicCamera_GetLeft(camera: TQ3CameraObject; VAR left: Single): TQ3Status; C;
  184. FUNCTION Q3OrthographicCamera_SetTop(camera: TQ3CameraObject; top: Single): TQ3Status; C;
  185. FUNCTION Q3OrthographicCamera_GetTop(camera: TQ3CameraObject; VAR top: Single): TQ3Status; C;
  186. FUNCTION Q3OrthographicCamera_SetRight(camera: TQ3CameraObject; right: Single): TQ3Status; C;
  187. FUNCTION Q3OrthographicCamera_GetRight(camera: TQ3CameraObject; VAR right: Single): TQ3Status; C;
  188. FUNCTION Q3OrthographicCamera_SetBottom(camera: TQ3CameraObject; bottom: Single): TQ3Status; C;
  189. FUNCTION Q3OrthographicCamera_GetBottom(camera: TQ3CameraObject; VAR bottom: Single): TQ3Status; C;
  190. {
  191. *****************************************************************************
  192.  **                                                                             **
  193.  **                            ViewPlane Camera                                  **
  194.  **                                                                             **
  195.  ****************************************************************************
  196. }
  197. FUNCTION Q3ViewPlaneCamera_New({CONST}VAR cameraData: TQ3ViewPlaneCameraData): TQ3CameraObject; C;
  198. FUNCTION Q3ViewPlaneCamera_GetData(camera: TQ3CameraObject; VAR cameraData: TQ3ViewPlaneCameraData): TQ3Status; C;
  199. FUNCTION Q3ViewPlaneCamera_SetData(camera: TQ3CameraObject; {CONST}VAR cameraData: TQ3ViewPlaneCameraData): TQ3Status; C;
  200. FUNCTION Q3ViewPlaneCamera_SetViewPlane(camera: TQ3CameraObject; viewPlane: Single): TQ3Status; C;
  201. FUNCTION Q3ViewPlaneCamera_GetViewPlane(camera: TQ3CameraObject; VAR viewPlane: Single): TQ3Status; C;
  202. FUNCTION Q3ViewPlaneCamera_SetHalfWidth(camera: TQ3CameraObject; halfWidthAtViewPlane: Single): TQ3Status; C;
  203. FUNCTION Q3ViewPlaneCamera_GetHalfWidth(camera: TQ3CameraObject; VAR halfWidthAtViewPlane: Single): TQ3Status; C;
  204. FUNCTION Q3ViewPlaneCamera_SetHalfHeight(camera: TQ3CameraObject; halfHeightAtViewPlane: Single): TQ3Status; C;
  205. FUNCTION Q3ViewPlaneCamera_GetHalfHeight(camera: TQ3CameraObject; VAR halfHeightAtViewPlane: Single): TQ3Status; C;
  206. FUNCTION Q3ViewPlaneCamera_SetCenterX(camera: TQ3CameraObject; centerXOnViewPlane: Single): TQ3Status; C;
  207. FUNCTION Q3ViewPlaneCamera_GetCenterX(camera: TQ3CameraObject; VAR centerXOnViewPlane: Single): TQ3Status; C;
  208. FUNCTION Q3ViewPlaneCamera_SetCenterY(camera: TQ3CameraObject; centerYOnViewPlane: Single): TQ3Status; C;
  209. FUNCTION Q3ViewPlaneCamera_GetCenterY(camera: TQ3CameraObject; VAR centerYOnViewPlane: Single): TQ3Status; C;
  210. {
  211. *****************************************************************************
  212.  **                                                                             **
  213.  **                            View Angle Aspect Camera                          **
  214.  **                                                                             **
  215.  ****************************************************************************
  216. }
  217. FUNCTION Q3ViewAngleAspectCamera_New({CONST}VAR cameraData: TQ3ViewAngleAspectCameraData): TQ3CameraObject; C;
  218. FUNCTION Q3ViewAngleAspectCamera_SetData(camera: TQ3CameraObject; {CONST}VAR cameraData: TQ3ViewAngleAspectCameraData): TQ3Status; C;
  219. FUNCTION Q3ViewAngleAspectCamera_GetData(camera: TQ3CameraObject; VAR cameraData: TQ3ViewAngleAspectCameraData): TQ3Status; C;
  220. FUNCTION Q3ViewAngleAspectCamera_SetFOV(camera: TQ3CameraObject; fov: Single): TQ3Status; C;
  221. FUNCTION Q3ViewAngleAspectCamera_GetFOV(camera: TQ3CameraObject; VAR fov: Single): TQ3Status; C;
  222. FUNCTION Q3ViewAngleAspectCamera_SetAspectRatio(camera: TQ3CameraObject; aspectRatioXToY: Single): TQ3Status; C;
  223. FUNCTION Q3ViewAngleAspectCamera_GetAspectRatio(camera: TQ3CameraObject; VAR aspectRatioXToY: Single): TQ3Status; C;
  224. {$ALIGN RESET}
  225. {$POP}
  226.  
  227. {$SETC UsingIncludes := QD3DCameraIncludes}
  228.  
  229. {$ENDC} {__QD3DCAMERA__}
  230.  
  231. {$IFC NOT UsingIncludes}
  232.  END.
  233. {$ENDC}
  234.